package com.xinya.wanandroidclient.http

import com.xinya.wanandroidclient.bean.*
import retrofit2.http.*

/**
 *
 * @ClassName:      WanAndroidApiService$
 * @Description:    api接口
 * @Author:         xinya
 * @CreateDate:     2021/2/24$ 11:25$
 * @UpdateRemark:   更新内容
 * @Version:        1.0
 */
interface WanAndroidApiService {
    /**
     * 首页Banner
     * https://www.wanandroid.com/banner/json
     */
    @GET("banner/json")
    suspend fun getHomeBanner(): ApiResponse<MutableList<HomeBannerBean>>

    /**
     * 首页文章列表
     * https://www.wanandroid.com/article/list/0/json
     */
    @GET("article/list/{page}/json")
    suspend fun getHomeArticle(@Path("page") page: Int): ApiResponse<HomeArticleBean>

    /**
     * 首页置顶文章
     * https://www.wanandroid.com/article/top/json
     */
    @GET("article/top/json")
    suspend fun getHomeTopArticle(): ApiResponse<MutableList<HomeArticleBean.Data>>

    /**
     * 获取微信公众号列表
     * https://wanandroid.com/wxarticle/chapters/json
     */
    @GET("wxarticle/chapters/json")
    suspend fun getWXArticleChapters(): ApiResponse<MutableList<ProjectClassificationBean>>

    /**
     * 查看具体公众号文章
     * https://wanandroid.com/wxarticle/list/408/1/json
     */
    @GET("wxarticle/list/{cid}/{page}/json")
    suspend fun getWXArticle(
        @Path("page") page: Int,
        @Path("cid") cid: Int,
    ): ApiResponse<ArticleBean>

    /**
     * 获取项目分类
     * https://www.wanandroid.com/project/tree/json
     */
    @GET("project/tree/json")
    suspend fun getProjectTree(): ApiResponse<MutableList<ProjectClassificationBean>>

    /**
     * 获取具体项目文章
     * https://www.wanandroid.com/project/list/1/json?cid=294
     */
    @GET("project/list/{page}/json")
    suspend fun getProjectArticle(
        @Path("page") page: Int,
        @Query("cid") cid: Int,
    ): ApiResponse<ArticleBean>

    /**
     * 获取体系下文章分类
     * https://www.wanandroid.com/tree/json
     */
    @GET("tree/json")
    suspend fun getSystemList(): ApiResponse<MutableList<SystemBean>>

    /**
     * 获取知识体系下的文章
     * https://www.wanandroid.com/article/list/0/json?cid=60
     */
    @GET("article/list/{page}/json")
    suspend fun getSystemArticle(
        @Path("page") page: Int,
        @Query("cid") cid: Int,
    ): ApiResponse<ArticleBean>

    /**
     * 收藏站内文章
     * https://www.wanandroid.com/lg/collect/1165/json
     */
    suspend fun collectionArticle(@Path("id") id: Int): ApiResponse<Any>

    /**
     * 获取导航分类
     * https://www.wanandroid.com/navi/json
     */
    @GET("navi/json")
    suspend fun getNaviList(): ApiResponse<MutableList<NaviBean>>

    /**
     * 登录
     * https://www.wanandroid.com/user/login
     */
    @FormUrlEncoded
    @POST("user/login")
    suspend fun login(
        @Field("username") userName: String,
        @Field("password") password: String,
    ): ApiResponse<LoginBean>

    /**
     *  退出登录
     *  https://www.wanandroid.com/user/logout/json
     */
    @GET("user/logout/json")
    suspend fun logout(): ApiResponse<Any>

    /**
     * 获取个人积分&排名(需要登录后访问)
     * https://www.wanandroid.com/lg/coin/userinfo/json
     */
    @GET("lg/coin/userinfo/json")
    suspend fun getUserInfo(): ApiResponse<UserInfoBean>




}